import {
  Controller,
  Get,
  Query,
  Request,
  Body,
  Param,
  Response,
} from '@nestjs/common';
import { AppService } from './app.service';
import { verify } from 'jsonwebtoken';
import {
  ApiTags,
  ApiOperation,
  ApiResponse,
  ApiParam,
  ApiQuery,
  ApiBody,
} from '@nestjs/swagger';
@ApiTags('tsest') // 标签
@Controller()
export class AppController {
  @ApiOperation({ summary: '测试接口' }) // 接口描述
  @ApiParam({
    name: 'name',
    description: '姓名',
    required: true,
  }) // 接口参数 param
  @ApiQuery({
    name: 'age',
    description: '年龄',
    required: true,
  }) // 接口参数 query
  @ApiResponse({
    status: 200,
    description: '请求成功',
    schema: {
      example: {
        code: 200,
        msg: '请求成功',
        data: {
          name: 'test',
        },
      },
    },
  })
  @Get('test/:age')
  test(@Request() req: Request) {
    return {
      code: 200,
      msg: '请求成功',
      data: {
        name: 'test',
      },
    };
  }
}
